<?php

namespace App\Http\Controllers;

use App\Http\Requests\Store\AddRequest;
use App\Http\Requests\Store\EditRequest;
use App\Http\Requests\Store\IndexRequest;
use App\Http\Requests\Store\InfoRequest;
use App\Http\Requests\Store\LoginRequest;
use App\Http\Requests\Store\SetStorePassRequest;
use App\Models\Store;

class StoreController extends Controller
{
    public function index(IndexRequest $request)
    {
        $inputs = $request->validated();
        return Store::index($inputs);
    }

    public function indexByAuth()
    {
        return Store::indexByAuth();
    }

    public function add(AddRequest $request)
    {
        $inputs = $request->validated();
        Store::add($inputs);
        return $this->created();
    }

    public function edit(EditRequest $request)
    {
        $inputs = $request->validated();
        Store::edit($inputs);
        return $this->noContent();
    }

    public function setStorePass(SetStorePassRequest $request)
    {
        $inputs = $request->validated();
        Store::setStorePass($inputs);
        return $this->noContent();
    }

    public function info(InfoRequest $request)
    {
        return Store::info($request->store);
    }

    public function login(LoginRequest $request)
    {
        $inputs = $request->validated();
        return Store::login($inputs);
    }
}
